package com.nmgsr.ptmsapp.activity;

import static com.nmgsr.ptmsapp.utils.DeviceHelper.getVersionCode;
import static com.nmgsr.ptmsapp.utils.DeviceHelper.getVersionName;

import static org.bouncycastle.asn1.x500.style.RFC4519Style.title;

import android.widget.TextView;

import com.lxj.xpopup.XPopup;
import com.nmgsr.beans.service.Api;
import com.nmgsr.nettools.base.BaseActivity;
import com.nmgsr.nettools.net.retrofit.HttpHelper;
import com.nmgsr.nettools.net.retrofit.HttpResponseObserver;
import com.nmgsr.nettools.net.retrofit.HttpUtil;
import com.nmgsr.nettools.util.ToastUtil;
import com.nmgsr.ptmsapp.R;
import com.nmgsr.ptmsapp.view.UpdateDialog;
import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;

public class UpdateActivity extends BaseActivity {
    private static final String TAG = UpdateActivity.class.getSimpleName();
    private QMUIRoundButton btn_check;
    protected String getActionBarTitle() {
        return "系统版本";
    }
    private boolean hasCancel=true;
    @Override
    protected int getLayoutId() {
        return R.layout.activity_update;
    }
    protected void initView() {
        super.initView();
        mContext = UpdateActivity.this;
        btn_check = findViewById(R.id.btn_check);
        TextView tv_version = findViewById(R.id.tv_version);
        tv_version.setText("当前版本: " + getVersionName(mContext));

        btn_check.setOnClickListener(v -> {
            checkUpdate();
        });
    }
    private void checkUpdate() {
        //showLoading("正在检查更新");
        int versionCode = getVersionCode(mContext);
        new XPopup.Builder(mContext)
                .asCustom(new UpdateDialog(mContext,"发现新版",null,false))
                .show();
    }
}
